package com.poetry.vup.common.exception;


import com.poetry.vup.common.result.BaseResult;
import com.poetry.vup.common.result.IErrorCode;

/**
 * 自定义异常工具类
 * @author mileswan
 *
 */
public class KabobExceptionUtil {

    public static void throwError(IErrorCode code, String message){
    	
        throw new KabobException(BaseResult.failed(code, message), new Exception(message));
    }
    
    public static void throwError(IErrorCode code, String message, Exception e){
    	
        throw new KabobException(BaseResult.failed(code, message), e);
    }
    
    public static void throwWarning(IErrorCode code, String message){
    	
        throw new KabobWarning(BaseResult.failed(code, message), new Exception(message));
    }
    
    public static void throwWarning(IErrorCode code, String message, Exception e){
    	
        throw new KabobWarning(BaseResult.failed(code, message), e);
    }

}